import service from "../serviceIndex";
// 获取地址
export const GetAddressAPI = (userId) => {
    return service({
        method: "get",
        url: `pipayshopapi/buyer-data/selectAllAddress/${userId}`,
    });
};
// 删除地址
export const DeleteAddressAPI = (id) => {
    return service({
        method: "post",
        url: `pipayshopapi/buyer-data/deleteBuyerDataById/${id}`,
    });
};
// 新增地址
export const AddAddressAPI = (addressData) => {
    return service({
        method: "post",
        url: `pipayshopapi//buyer-data/insectBuyerData`,
        data: addressData,
    });
};
// 修改地址
export const ReverseAddressAPI = (data) => {
    return service({
        method: "post",
        url: `pipayshopapi/buyer-data/updateBuyerDataById`,
        data: data,
    });
};
// 提交订单生成未支付订单
export const generateUnpaidOrderAPI = (token) => {
    return service({
        method: "post",
        url: `pipayshopapi/order/generateUnpaidOrder`,
        params: {
            token
        }
    });
};

// 根据订单号查询订单详情
export const getOrderDetailAPI = (orderId) => {
    return service({
        method: "get",
        url: `/pipayshopapi/item-order/getOrderDetail/${orderId}`,
    });
};

// 根据用户id查找名下的所有实体店铺的shopId列表(实体店)
export const getShopIdListByUid = (uid) => {
    return service({
        method: "get",
        url: `pipayshopapi/shop-info/getShopIdListByUid/${uid}`,
    });
};

// 将多家实体店一起升级为vip店铺
export const upVipByShopIdList = (params) => {
    return service({
        method: "post",
        url: `pipayshopapi/shop-info/upVipByShopIdList`,
        params,
    });
};

// 根据店铺id查询该店铺是否为vip店铺
export const isVipShop = (shopId) => {
    return service({
        method: "get",
        url: `pipayshopapi/shop-info/isVipShop/${shopId}`,
    });
};
// 获取实体店-商品-评论列表
export const commodityEvaluateList = (commodityId, pageNum, pageSize) => {
    return service({
        method: "get",
        url: `pipayshopapi/store-commodity-evaluate/commodityEvaluateList/${commodityId}/${pageNum}/${pageSize}`,
    });
};
// 删除实体店-商品-评论
export const deleteEvaluate = (evaluateId, userId) => {
    return service({
        method: "post",
        url: `pipayshopapi/shop-commodity-evaluate/deleteEvaluate/${evaluateId}/${userId}`,
    });
};
// 获取网店商品评价列表
export const getItemCommodityEvaluates = (commodityId, currentPage, limit) => {
    return service({
        method: "get",
        url: `pipayshopapi/evaluate/getShopCommodityEvaluates/${commodityId}/${currentPage}/${limit}`,
    });
};
// 根据评价Id删除网店商品自己评价
export const deleteItemEvaluates = (evaluateId, userId) => {
    return service({
        method: "post",
        url: `pipayshopapi/evaluate/deleteShopEvaluates/${evaluateId}/${userId}`,
    });
};
// 根据实体店id获取实体店评价列表
export const getShopEvaluateListByItemId = (page, limit, shopId) => {
    return service({
        method: "get",
        url: `pipayshopapi/store-evaluate/getShopEvaluateListByItemId/${page}/${limit}/${shopId}`,
    });
};
// 删除实体店评价列表
export const deleteShopEvaluate = (evaluateId, userId) => {
    return service({
        method: "post",
        url: `pipayshopapi/store-evaluate/deleteShopEvaluate/${evaluateId}/${userId}`,
    });
};
// 校验当前用户是否已经对该商品进行了评价
export const isEvaluates = (commodityId, userId) => {
    return service({
        method: "get",
        url: `/pipayshopapi/item-commodity-evaluate/isEvaluates/${commodityId}/${userId}`,
    });
};
//根据id查询有多少家店铺
export const getShopNumberAPI = (uid) => {
    return service({
        method: "get",
        url: `/pipayshopapi/store-info/getShopNumber/${uid}`,
    });
};
//根据id查询是否是vip用户
export const isVipUserAPI = (uid) => {
    return service({
        method: "get",
        url: `/pipayshopapi/user-info/isVipUser/${uid}`,
    });
};
//升级为商家用户
export const upToVipUserAPI = (userId) => {
    return service({
        method: "post",
        url: `/pipayshopapi/user-info/upToVipUser/${userId}`,
    });
};